package com.example.tourstor;

import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

import com.leon.lib.settingview.LSettingItem;

public class PlanFragment extends Fragment{

    private static final String TAG = "PlanFragment";
    private TextView title;
    private com.leon.lib.settingview.LSettingItem item_makeplan,item_myplan,item_helpplan;
    private Button title_btn_left,title_btn_right;




    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.frame_plan, container);

    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        View view = getActivity().getLayoutInflater().inflate(R.layout.title,null);
        view.setBackgroundColor(Color.parseColor("#fb9d26"));
        setTitle();

        item_makeplan = getActivity().findViewById(R.id.item_makeplan);
        item_myplan = getActivity().findViewById(R.id.item_myplan);
        item_helpplan = getActivity().findViewById(R.id.item_helpplan);

        item_makeplan.setmOnLSettingItemClick(new LSettingItem.OnLSettingItemClick() {
            @Override
            public void click() {
                Intent intent=new Intent(getActivity(),MakePlanActivity.class);
                startActivity(intent);
                Log.i(TAG, "click: 跳转到制定计划界面：");
            }
        });
        item_myplan.setmOnLSettingItemClick(new LSettingItem.OnLSettingItemClick() {
            @Override
            public void click() {
                Intent intent=new Intent(getActivity(),MyPlanActivity2.class);
                startActivity(intent);
                Log.i(TAG, "click: 跳转到我的计划界面：");
            }
        });
        item_helpplan.setmOnLSettingItemClick(new LSettingItem.OnLSettingItemClick() {
            @Override
            public void click() {
                Intent intent=new Intent(getContext(),HelpPlanActivity.class);
                startActivity(intent);
                Log.i(TAG, "click: 跳转到助力计划界面：");
            }
        });
    }
    public void setTitle(){
        title = getActivity().findViewById(R.id.title_text);
        title.setText("");
        title_btn_left = getActivity().findViewById(R.id.title_btn_left);
        title_btn_right = getActivity().findViewById(R.id.title_btn_right);
        title_btn_left.setText("计划");
        title_btn_right.setText("");
        title_btn_left.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                getActivity().finish();
            }
        });
        title_btn_right.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
            }
        });





    }
}
